package com.ehome.poct.base.banner.service;

import com.ehome.poct.base.api.dto.banner.*;
import com.ehome.poct.base.api.virtual.BannerService;
import com.ehome.poct.base.api.vo.banner.*;
import com.ehome.poct.base.banner.repository.BannerRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author muqiu
 * @date 2022/03/02 14:15
 */
@Service
public class BannerServiceImpl implements BannerService {
    @Autowired private BannerRepository bannerRepository;

    /**
     * banner广告
     * @return
     */
    @Override
    public List<BannerVO> list(Integer deviceType) {
        return bannerRepository.list(deviceType);
    }

    /**
     * 广告曝光数增加
     * @param dto
     */
    @Override
    public void incrExposureById(BannerExposureDTO dto) {
        bannerRepository.incrExposureById(dto);
    }

    @Override
    public Boolean add(BannerDTO bannerDTO) {
        return bannerRepository.add(bannerDTO);
    }

    @Override
    public List<BannerDictDataVO> getDictData() {
        return bannerRepository.getDictData();
    }

    @Override
    public BannerInfoPageVO getBanners(BannerPageDTO bannerPageDTO) {
        return bannerRepository.getBanners(bannerPageDTO);
    }

    @Override
    public BannerInfoVO getById(Long id) {
        return bannerRepository.getById(id);
    }

    @Override
    public Boolean disable(BannerAbleDTO ableDTO) {
        return bannerRepository.disable(ableDTO);
    }

    @Override
    public Boolean delete(Long id) {
        return bannerRepository.delete(id);
    }

    @Override
    public BannerDataVO getData(BannerDataDTO bannerDataDTO) {
        return bannerRepository.getData(bannerDataDTO);
    }
}
